/**
操作cookie
 */
define(function(){
	return{
		//写入cookie
		setCookie : function(name,value,days,path = '/'){
			var oDate = new Date(); //获取当前时间
			oDate.setDate(oDate.getDate() + days);//设置过期时间
			document.cookie = name + '=' + encodeURIComponent(value) + ';expires=' + oDate + ';path=' + path;//写入cookie
		},
		//查看cookie
		getCookie : function(name){
			var aCookie = document.cookie.split('; ');//对cookie进行切割,得到数组
			for (var i = 0; i < aCookie.length; i++) {
				var oTemp = aCookie[i].split('='); //此时再次对数组中的每个对象进行切割
				if(oTemp[0] === name){
					return decodeURIComponent(oTemp[1]); //获取当前对应的数值,并进行逆转化
				}
			}
		},
		//删除cookie
		removeCookie : function(name,path = '/'){
			document.cookie = name +'=;expires=-1;path=' + path; //将cookie转换成会话级别
		}
	}
});